#include <cstdio>

int main( )
{
    int f[ 31 ], n, c, i;
    f[ 0 ] = f[ 1 ] = 1;
    for ( i = 2; i <= 30; i++ )
        f[ i ] = f[ i - 1 ] + f[ i - 2 ] * 2;
    scanf("%d", &c);
    while ( c-- )
    {
        scanf("%d", &n);
        printf("%d\n", f[ n ]);
    }
    return 0;
}
